In the following descriptions assume: - S is a String - ch is a char - n,i,p,l are int's - s is a side type (Left,Right,Both) - C is either a char, const char *, const String & - X is either a C or a const Regex & - Y is either a X or a int (pos) - Z is either a Y or a int,int (pos and len) - R is a Regular Expression return types -- - bool is an int value where zero is false and non-zero is true - ushort is an unsigned short - String& is a reference to S - SubString is a SubString within S, and can be used on the left hand of assignment ie. S.after("hello")="good bye"; Constructors - String() creates a empty String // String s; String(n) creates a String with pre-allocated size n // String s(32); String(ch) creates a String equal to character ch // String space(' '); String(const char *) creates a String equal to const char * // String word("hello"); String(const char *s,int n) creates a String equal to const char *,with length n // String word(s,4); String(const String &s) creates a String equal to another String // String s(word); returns function description ------- -------- ----------- String& S = X assigns X to S String& S += Y appends Y to the end of S String& S -= Y removes Y if at end of S String& S *= n multiplies S by n String& S /= X remove all occurances of X from String String C1 + C2 concats S2 to S1 String C1 - C2 removes string S2 if at the end of S1 String S / X remove all occurances of S2 from S1 char S[i] returns char indexed by 'i' SubString S(Z) returns the substring Z in S bool !S true if length=0 bool C1 < C2 standard relational bool C1 <= C2 " " bool C1 == C2 " " bool C1 != C2 " " bool C1 >= C2 " " bool C1 > C2 " " ushort S.length() returns length of string bool S.empty() true if length=0 const char* (const char *) S converts string to const char * char* S.cptr() converts string to char * bool(void *) S true if length!=0 // if (S) ... ostream& ios << S outputs string istream& ios >> S inputs string int getline(ios,S,ch) reads a line into S from steam ios, using delimiter ch,returns length int S.index(X) position of X within S bool S.contains(X) true if S contains X SubString S.substr(p) substring starting at p to end of S SubString S.substr(p,l) substring starting at p with length l SubString S.left(n) left n characters in S SubString S.right(n) right n characters in S SubString S.between(n1,n2) characters between n1 and n2 String& S.insert(p,C) inserts C into S at position p String& S.prepend(C) prepends C to S String& S.append(C) appends C to S String& S.remove(Z) removes Z from S SubString S.before(Y) substring S before Y SubString S.through(Y) substring through (upto and including) Y SubString S.at(Z) substring at Z SubString S.from(Y) substring from Y to end of S SubString S.after(Y) substring after Y to end of S String S.except(Z) everything in S except Z SubString S.skip(X) skips optional X, returns substring after SubString S.ws() skips white space String& S.replace(X1,X2) replaces X1 with X2 SubString S.pos(i) assigns i current position within S SubString S.moveto(X) moves upto X and returns from X to end SubString S.find(X) finds X in S, return after X to end SubString S.match(X) matches X with leftmost side of S int S.split(R,S1[],n) splits S into string array S1[0..n], on Regex R and returns number split String& S.trim(s) trims white space on side s String& S.pad(n,s,ch) pads to length n with char ch on side s String& S.trunc(n) truncates S to length n String& S.upper() upper cases string String& S.lower() lower cases string String& S.reverse() reverse string String& S.icase() ignores case during next relational operation // S.icase() < "HELLO" String& S.ucase() uses case during next relational op. void S.dump() dumps out string contents (for debug) void S.exception() exits program and dumps out string